home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / IsochronousDataHandler.h < prev    next >
Encoding:
Text File  |  2000-04-12  |  12.2 KB  |  400 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        IsochronousDataHandler.h
  3.  
  4.      Contains:    The defines the client API to an Isochronous Data Handler, which is
  5.  
  6.      Version:    Technology:    xxx put version here xxx
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1997-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. //
  18. // Check for Prior Inclusion of IsochronousDataHandler.r
  19. //    If this header is trying to be included via a Rez path, make it act
  20. //    as a NOP.  This will allow both Rez & C files to get to use the
  21. //    contants for the component type, subtype, and interface version.
  22. #ifndef __ISOCHRONOUSDATAHANDLER_R__
  23.  
  24.  
  25. #ifndef __ISOCHRONOUSDATAHANDLER__
  26. #define __ISOCHRONOUSDATAHANDLER__
  27.  
  28. #ifndef __MACTYPES__
  29.     #include <MacTypes.h>
  30. #endif
  31.  
  32. #ifndef __MOVIESFORMAT__
  33.     #include <MoviesFormat.h>
  34. #endif
  35.  
  36. #ifndef __QUICKTIMECOMPONENTS__
  37.     #include <QuickTimeComponents.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. #if PRAGMA_ONCE
  47. #pragma once
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if PRAGMA_IMPORT
  55. #pragma import on
  56. #endif
  57.  
  58. #if PRAGMA_STRUCT_ALIGN
  59.     #pragma options align=mac68k
  60. #elif PRAGMA_STRUCT_PACKPUSH
  61.     #pragma pack(push, 2)
  62. #elif PRAGMA_STRUCT_PACK
  63.     #pragma pack(2)
  64. #endif
  65.  
  66. enum {
  67.     kIDHComponentType            = FOUR_CHAR_CODE('ihlr'),        /* Component type*/
  68.     kIDHSubtypeDV                = FOUR_CHAR_CODE('dv  '),        /* Subtype for DV (over FireWire)*/
  69.     kIDHSubtypeFireWireConference = FOUR_CHAR_CODE('fwc ')        /* Subtype for FW Conference*/
  70. };
  71.  
  72.  
  73. /* Version of Isochronous Data Handler API*/
  74. enum {
  75.     kIDHInterfaceVersion1        = 0x0001                        /* Initial relase (Summer '99)*/
  76. };
  77.  
  78.  
  79. /* atom types*/
  80.  
  81. enum {
  82.     kIDHDeviceListAtomType        = FOUR_CHAR_CODE('dlst'),
  83.     kIDHDeviceAtomType            = FOUR_CHAR_CODE('devc'),        /* to be defined elsewhere*/
  84.     kIDHIsochServiceAtomType    = FOUR_CHAR_CODE('isoc'),
  85.     kIDHIsochModeAtomType        = FOUR_CHAR_CODE('mode'),
  86.     kIDHDeviceIDType            = FOUR_CHAR_CODE('dvid'),
  87.     kIDHIsochVersionAtomType    = FOUR_CHAR_CODE('iver'),
  88.     kIDHUniqueIDType            = FOUR_CHAR_CODE('unid'),
  89.     kIDHNameAtomType            = FOUR_CHAR_CODE('name'),
  90.     kIDHIsocMediaType            = FOUR_CHAR_CODE('av  '),
  91.     kIDHDataTypeAtomType        = FOUR_CHAR_CODE('dtyp'),
  92.     kIDHDataSizeAtomType        = FOUR_CHAR_CODE('dsiz'),        /* ??? packet size vs. buffer size*/
  93.     kIDHDataBufferSizeAtomType    = FOUR_CHAR_CODE('dbuf'),        /* ??? packet size vs. buffer size*/
  94.     kIDHDataIntervalAtomType    = FOUR_CHAR_CODE('intv'),
  95.     kIDHDataIODirectionAtomType    = FOUR_CHAR_CODE('ddir'),
  96.     kIDHSoundMediaAtomType        = FOUR_CHAR_CODE('soun'),
  97.     kIDHSoundTypeAtomType        = FOUR_CHAR_CODE('type'),
  98.     kIDHSoundChannelCountAtomType = FOUR_CHAR_CODE('ccnt'),
  99.     kIDHSoundSampleSizeAtomType    = FOUR_CHAR_CODE('ssiz'),
  100.     kIDHSoundSampleRateAtomType    = FOUR_CHAR_CODE('srat'),        /* same as video out... (what does this comment mean?)*/
  101.     kIDHVideoMediaAtomType        = FOUR_CHAR_CODE('vide'),
  102.     kIDHVideoDimensionsAtomType    = FOUR_CHAR_CODE('dimn'),
  103.     kIDHVideoResolutionAtomType    = FOUR_CHAR_CODE('resl'),
  104.     kIDHVideoRefreshRateAtomType = FOUR_CHAR_CODE('refr'),
  105.     kIDHVideoPixelTypeAtomType    = FOUR_CHAR_CODE('pixl'),
  106.     kIDHVideoDecompressorAtomType = FOUR_CHAR_CODE('deco'),
  107.     kIDHVideoDecompressorTypeAtomType = FOUR_CHAR_CODE('dety'),
  108.     kIDHVideoDecompressorContinuousAtomType = FOUR_CHAR_CODE('cont'),
  109.     kIDHVideoDecompressorComponentAtomType = FOUR_CHAR_CODE('cmpt')
  110. };
  111.  
  112. /* I/O Flags */
  113. enum {
  114.     kIDHDataTypeIsInput            = 1L << 0,
  115.     kIDHDataTypeIsOutput        = 1L << 1,
  116.     kIDHDataTypeIsInputAndOutput = 1L << 2
  117. };
  118.  
  119.  
  120. /* Permission Flags */
  121. enum {
  122.     kIDHOpenForReadTransactions    = 1L << 0,
  123.     kIDHOpenForWriteTransactions = 1L << 1,
  124.     kIDHOpenWithExclusiveAccess    = 1L << 2,
  125.     kIDHOpenWithHeldBuffers        = 1L << 3                        /* IDH will hold buffer until ReleaseBuffer()*/
  126. };
  127.  
  128.  
  129. /*
  130.    Errors 
  131.       These REALLY need to be moved into Errors.h
  132.    ooo.needs officially assigned numbers
  133. */
  134. enum {
  135.     kIDHErrDeviceDisconnected    = -14101,
  136.     kIDHErrInvalidDeviceID        = -14102,
  137.     kIDHErrDeviceInUse            = -14104,
  138.     kIDHErrDeviceNotOpened        = -14105,
  139.     kIDHErrDeviceBusy            = -14106,
  140.     kIDHErrDeviceReadError        = -14107,
  141.     kIDHErrDeviceWriteError        = -14108,
  142.     kIDHErrDeviceNotConfigured    = -14109,
  143.     kIDHErrDeviceList            = -14110,
  144.     kIDHErrCompletionPending    = -14111,
  145.     kIDHErrDeviceTimeout        = -14112,
  146.     kIDHErrInvalidIndex            = -14113,
  147.     kIDHErrDeviceCantRead        = -14114,
  148.     kIDHErrDeviceCantWrite        = -14115
  149. };
  150.  
  151.  
  152.  
  153.  
  154. /* Holds Device Identification...*/
  155. typedef UInt32                             IDHDeviceID;
  156. enum {
  157.     kIDHInvalidDeviceID            = 0,
  158.     kIDHDeviceIDEveryDevice        = (long)0xFFFFFFFF
  159. };
  160.  
  161.  
  162. /*    Isoch Interval Atom Data*/
  163.  
  164. struct IDHIsochInterval {
  165.     SInt32                             duration;
  166.     TimeScale                         scale;
  167. };
  168. typedef struct IDHIsochInterval            IDHIsochInterval;
  169. /* Need to fix this.  For now, cast this as a FWReferenceID*/
  170. typedef struct OpaquePsuedoID*             PsuedoID;
  171. /*
  172.    Isoch Device Status
  173.       This is atom-like, but isn't an atom
  174. */
  175.  
  176. struct IDHDeviceStatus {
  177.     UInt32                             version;
  178.     Boolean                         physicallyConnected;
  179.     Boolean                         readEnabled;
  180.     Boolean                         writeEnabled;
  181.     Boolean                         exclusiveAccess;
  182.     UInt32                             currentBandwidth;
  183.     UInt32                             currentChannel;
  184.     PsuedoID                         localNodeID;                /*ooo.may go in atoms */
  185.     SInt16                             inputStandard;                /* One of the QT input standards*/
  186.     Boolean                         deviceActive;
  187. };
  188. typedef struct IDHDeviceStatus            IDHDeviceStatus;
  189. /*
  190.    Isochronous Data Handler Events
  191.     
  192. */
  193.  
  194. typedef UInt32                             IDHEvent;
  195. enum {
  196.     kIDHEventInvalid            = 0,
  197.     kIDHEventDeviceAdded        = 1L << 0,                        /* A new device has been added to the bus*/
  198.     kIDHEventDeviceRemoved        = 1L << 1,                        /* A device has been removed from the bus*/
  199.     kIDHEventDeviceChanged        = 1L << 2,                        /* Some device has changed state on the bus*/
  200.     kIDHEventReadEnabled        = 1L << 3,                        /* A client has enabled a device for read*/
  201.     kIDHEventReserved1            = 1L << 4,                        /* Reserved for future use*/
  202.     kIDHEventReadDisabled        = 1L << 5,                        /* A client has disabled a device from read*/
  203.     kIDHEventWriteEnabled        = 1L << 6,                        /* A client has enabled a device for write*/
  204.     kIDHEventReserved2            = 1L << 7,                        /* Reserved for future use*/
  205.     kIDHEventWriteDisabled        = 1L << 8,                        /* A client has disabled a device for write*/
  206.     kIDHEventEveryEvent            = (long)0xFFFFFFFF
  207. };
  208.  
  209. typedef UInt32                             IDHNotificationID;
  210.  
  211. struct IDHEventHeader {
  212.     IDHDeviceID                     deviceID;                    /* Device which generated event*/
  213.     IDHNotificationID                 notificationID;
  214.     IDHEvent                         event;                        /* What the event is*/
  215. };
  216. typedef struct IDHEventHeader            IDHEventHeader;
  217.  
  218.  
  219.  
  220. /*
  221.    IDHGenericEvent
  222.       An IDH will often have to post events from at interrupt time.  Since memory
  223.       allocation cannot occur from the interrupt handler, the IDH can preallocate
  224.       storage needed for handling the event by creating some IDHGenericEvent items.
  225.       Subsequently, when an event is generated, the type of event (specified in the
  226.       IDHEventHeader) will dictate how the IDHGenericEvent should be interpretted.
  227.       
  228.       IMPORTANT NOTE : This means that a specific event structure can NEVER be greater
  229.       than the size of the generic one.
  230.       
  231. */
  232.  
  233. struct IDHGenericEvent {
  234.     IDHEventHeader                     eventHeader;
  235.     UInt32                             pad[4];
  236. };
  237. typedef struct IDHGenericEvent            IDHGenericEvent;
  238. /*
  239.    IDHDeviceConnectionEvent
  240.       For kIDHEventDeviceAdded or kIDHEventDeviceRemoved events.
  241. */
  242.  
  243. struct IDHDeviceConnectionEvent {
  244.     IDHEventHeader                     eventHeader;
  245. };
  246. typedef struct IDHDeviceConnectionEvent    IDHDeviceConnectionEvent;
  247. /*
  248.    IDHDeviceIOEnableEvent
  249.       For kIDHEventReadEnabled, kIDHEventReadDisabled, kIDHEventWriteEnabled, or
  250.       kIDHEventWriteDisabled.
  251. */
  252.  
  253. struct IDHDeviceIOEnableEvent {
  254.     IDHEventHeader                     eventHeader;
  255. };
  256. typedef struct IDHDeviceIOEnableEvent    IDHDeviceIOEnableEvent;
  257. typedef CALLBACK_API_C( OSStatus , IDHNotificationProc )(IDHGenericEvent *event, void *userData);
  258.  
  259. struct IDHParameterBlock {
  260.     UInt32                             reserved1;
  261.     UInt16                             reserved2;
  262.     void *                            buffer;
  263.     ByteCount                         requestedCount;
  264.     ByteCount                         actualCount;
  265.     IDHNotificationProc             completionProc;
  266.     void *                            refCon;
  267.     OSErr                             result;
  268. };
  269. typedef struct IDHParameterBlock        IDHParameterBlock;
  270.  
  271. struct IDHResolution {
  272.     UInt32                             x;
  273.     UInt32                             y;
  274. };
  275. typedef struct IDHResolution            IDHResolution;
  276.  
  277. struct IDHDimension {
  278.     Fixed                             x;
  279.     Fixed                             y;
  280. };
  281. typedef struct IDHDimension                IDHDimension;
  282.  
  283. EXTERN_API( ComponentResult )
  284. IDHGetDeviceList                (ComponentInstance         idh,
  285.                                  QTAtomContainer *        deviceList)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  286.  
  287. EXTERN_API( ComponentResult )
  288. IDHGetDeviceConfiguration        (ComponentInstance         idh,
  289.                                  QTAtomSpec *            configurationID)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0002, 0x7000, 0xA82A);
  290.  
  291. EXTERN_API( ComponentResult )
  292. IDHSetDeviceConfiguration        (ComponentInstance         idh,
  293.                                  const QTAtomSpec *        configurationID)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0003, 0x7000, 0xA82A);
  294.  
  295. EXTERN_API( ComponentResult )
  296. IDHGetDeviceStatus                (ComponentInstance         idh,
  297.                                  const QTAtomSpec *        configurationID,
  298.                                  IDHDeviceStatus *        status)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0004, 0x7000, 0xA82A);
  299.  
  300. EXTERN_API( ComponentResult )
  301. IDHGetDeviceClock                (ComponentInstance         idh,
  302.                                  Component *            clock)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  303.  
  304. EXTERN_API( ComponentResult )
  305. IDHOpenDevice                    (ComponentInstance         idh,
  306.                                  UInt32                 permissions)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  307.  
  308. EXTERN_API( ComponentResult )
  309. IDHCloseDevice                    (ComponentInstance         idh)                                FIVEWORDINLINE(0x2F3C, 0x0000, 0x0007, 0x7000, 0xA82A);
  310.  
  311. EXTERN_API( ComponentResult )
  312. IDHRead                            (ComponentInstance         idh,
  313.                                  IDHParameterBlock *    pb)                                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0008, 0x7000, 0xA82A);
  314.  
  315. EXTERN_API( ComponentResult )
  316. IDHWrite                        (ComponentInstance         idh,
  317.                                  IDHParameterBlock *    pb)                                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0009, 0x7000, 0xA82A);
  318.  
  319. EXTERN_API( ComponentResult )
  320. IDHNewNotification                (ComponentInstance         idh,
  321.                                  IDHDeviceID             deviceID,
  322.                                  IDHNotificationProc     notificationProc,
  323.                                  void *                    userData,
  324.                                  IDHNotificationID *    notificationID)                        FIVEWORDINLINE(0x2F3C, 0x0010, 0x000A, 0x7000, 0xA82A);
  325.  
  326. EXTERN_API( ComponentResult )
  327. IDHNotifyMeWhen                    (ComponentInstance         idh,
  328.                                  IDHNotificationID         notificationID,
  329.                                  IDHEvent                 events)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000B, 0x7000, 0xA82A);
  330.  
  331. EXTERN_API( ComponentResult )
  332. IDHCancelNotification            (ComponentInstance         idh,
  333.                                  IDHNotificationID         notificationID)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  334.  
  335. EXTERN_API( ComponentResult )
  336. IDHDisposeNotification            (ComponentInstance         idh,
  337.                                  IDHNotificationID         notificationID)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x000D, 0x7000, 0xA82A);
  338.  
  339. EXTERN_API( ComponentResult )
  340. IDHReleaseBuffer                (ComponentInstance         idh,
  341.                                  IDHParameterBlock *    pb)                                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x000E, 0x7000, 0xA82A);
  342.  
  343. EXTERN_API( ComponentResult )
  344. IDHCancelPendingIO                (ComponentInstance         idh,
  345.                                  IDHParameterBlock *    pb)                                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x000F, 0x7000, 0xA82A);
  346.  
  347. EXTERN_API( ComponentResult )
  348. IDHGetDeviceControl                (ComponentInstance         idh,
  349.                                  ComponentInstance *    deviceControl)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0010, 0x7000, 0xA82A);
  350.  
  351. EXTERN_API( ComponentResult )
  352. IDHUpdateDeviceList                (ComponentInstance         idh,
  353.                                  QTAtomContainer *        deviceList)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0011, 0x7000, 0xA82A);
  354.  
  355.  
  356. /* selectors for component calls */
  357. enum {
  358.     kIDHGetDeviceListSelect                            = 0x0001,
  359.     kIDHGetDeviceConfigurationSelect                = 0x0002,
  360.     kIDHSetDeviceConfigurationSelect                = 0x0003,
  361.     kIDHGetDeviceStatusSelect                        = 0x0004,
  362.     kIDHGetDeviceClockSelect                        = 0x0005,
  363.     kIDHOpenDeviceSelect                            = 0x0006,
  364.     kIDHCloseDeviceSelect                            = 0x0007,
  365.     kIDHReadSelect                                    = 0x0008,
  366.     kIDHWriteSelect                                    = 0x0009,
  367.     kIDHNewNotificationSelect                        = 0x000A,
  368.     kIDHNotifyMeWhenSelect                            = 0x000B,
  369.     kIDHCancelNotificationSelect                    = 0x000C,
  370.     kIDHDisposeNotificationSelect                    = 0x000D,
  371.     kIDHReleaseBufferSelect                            = 0x000E,
  372.     kIDHCancelPendingIOSelect                        = 0x000F,
  373.     kIDHGetDeviceControlSelect                        = 0x0010,
  374.     kIDHUpdateDeviceListSelect                        = 0x0011
  375. };
  376.  
  377.  
  378. #endif /* ifndef __ISOCHRONOUSDATAHANDLER_R__ */
  379.  
  380. #if PRAGMA_STRUCT_ALIGN
  381.     #pragma options align=reset
  382. #elif PRAGMA_STRUCT_PACKPUSH
  383.     #pragma pack(pop)
  384. #elif PRAGMA_STRUCT_PACK
  385.     #pragma pack()
  386. #endif
  387.  
  388. #ifdef PRAGMA_IMPORT_OFF
  389. #pragma import off
  390. #elif PRAGMA_IMPORT
  391. #pragma import reset
  392. #endif
  393.  
  394. #ifdef __cplusplus
  395. }
  396. #endif
  397.  
  398. #endif /* __ISOCHRONOUSDATAHANDLER__ */
  399.  
  400.